//
//  YLProductListTableViewCell.m
//  YLFinanceService
//
//  Created by she1323 on 2017/11/9.
//  Copyright © 2017年 she1323. All rights reserved.
//

#import "YLProductListTableViewCell.h"
#import "YLProductListModel.h"
#import <UIImageView+WebCache.h>
@interface YLProductListTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *projectInfoNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *areasTextLabel;
@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
@property (weak, nonatomic) IBOutlet UIImageView *statusImage;
@property (weak, nonatomic) IBOutlet UIImageView *touMingImageView;
@property (weak, nonatomic) IBOutlet UIImageView *projectImageView;

@end

@implementation YLProductListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (void)setModel:(YLProductListModel *)model
{
    _model = model;
    _statusImage.hidden = NO;
    _projectInfoNameLabel.text = model.projectInfoName;
    _areasTextLabel.text = model.areasText;
    [_projectImageView sd_setImageWithURL: [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", YLImageURL ,model.projectInfoIcon]]];
    if (model.isReservation == YES) {
        // 预约
        _statusImage.image = [UIImage imageNamed:@"yuyueok"];
        _statusLabel.text = @"已预约";
        _statusLabel.textColor = [UIColor orangeColor];
        _touMingImageView.hidden = YES;
    } else {
        if (model.projectInfoState == 1) {
            // 上架
            _touMingImageView.hidden = YES;
            _statusImage.image = [UIImage imageNamed:@"whiteClock"];
            _statusLabel.textColor = [UIColor whiteColor];
            _statusLabel.text = @"预约咨询";
        } else {
            _touMingImageView.hidden = NO;
            _statusImage.hidden = YES;
            _statusLabel.textColor = [UIColor whiteColor];
            _statusLabel.text = @"已下线";
        }
    }
    
}

+ (NSString *)cellID
{
    return @"YLProductListTableViewCell";
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
